'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;
  const jwt = app.middleware.jwt({app})
  router.get('/', controller.home.index);

  // 获取验证码
  router.get('/captcha', controller.utils.captcha);
  router.get('/sendcode', controller.utils.sendcode);
  router.post('/uploadfile',controller.utils.uploadfile)
  router.post('/mergeFile',controller.utils.mergeFile)
  router.post('/checkFile',controller.utils.checkFile)


  router.group({name:'user',prefix:'/user'},router=>{
    const {info,register,login,verify} = controller.user

    router.post('/register',register)

    router.get('/info',jwt,info)

    router.post('/login',login)
    router.get('/verify',verify)

  })
};
